package com.lai.controllers;

import com.lai.dao.JdbcUserDao;
import com.lai.entities.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: wlai
 * Date: 8/1/13
 * Time: 5:07 PM
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private JdbcUserDao userDao;
    @RequestMapping(params = "act=list")
    public String listUsers(ModelMap modelMap){
        List<User> users=userDao.listUsers();
        modelMap.put("users",users);
        return "user/list";

    }

}
